Skip to content

feat: add estimated reading time to articles - #5044

Open
anshul23102 wants to merge 2 commits into
codeharborhub:mainfrom
anshul23102:feat/5027-reading-time
Open

feat: add estimated reading time to articles#5044
anshul23102 wants to merge 2 commits into
codeharborhub:mainfrom
anshul23102:feat/5027-reading-time

Conversation

@anshul23102

@anshul23102 anshul23102 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Implements estimated reading time calculation for all documentation pages.

Changes

  • Created remark plugin to calculate reading time based on word count
  • Weights code blocks at 0.5x since developers read code differently than prose
  • Uses 200 words/minute baseline with minimum 1 minute estimate
  • Injects readingTime into frontmatter for theme component consumption

Implementation Details

  • Plugin: calculates words in text nodes, applies 0.5x weight to code blocks
  • Formula: totalWords = textWords + (codeWords * 0.5) / 200 words per minute
  • Frontmatter: readingTime value injected for use in article components

Next Steps for Display

  • Update article card component to show '{readingTime} min read'
  • Update article header component to display reading time next to publish date
  • Add styling for reading time display

Testing

  • Plugin correctly calculates reading time for various document structures
  • Code blocks properly weighted at 0.5x
  • Frontmatter injection working correctly

Fixes #5027

Closes #5027

- Create remark plugin to compute estimated reading time based on word count
- Use 200 words per minute baseline with minimum 1 minute estimate
- Weight code blocks at 0.5x since code is read differently than prose
- Inject readingTime into frontmatter for consumption by components
- Supports both code blocks and inline code

Implements core logic for codeharborhub#5027
- Import remark-reading-time plugin
- Add plugin to docs remarkPlugins array
- Plugin will calculate and inject readingTime into frontmatter for all markdown documents
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anshul23102! 👋 Thank you for submitting your first pull request to CodeHarborHub. Great job on the contribution! 🎉 We appreciate your efforts and our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Keep up the great work!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, @anshul23102! 🎉 Thank you for submitting your pull request to CodeHarborHub. We appreciate your contribution and enthusiasm! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Thanks for contributing!

@deepsource-io

deepsource-io Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

DeepSource Code Review

We reviewed changes in d148591...cf85c43 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jul 27, 2026 5:46p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@github-actions

Copy link
Copy Markdown

⚡️ Lighthouse Report for the Deploy Preview of this PR 🚀

🔗 Site: CodeHarborHub | Live Site

URL 🌐 Performance Accessibility Best Practices SEO 📊
/ 🔴 38 🟡 77 🟡 75 🟢 100 📄
/docs 🟡 63 🟡 87 🟢 96 🟢 100 📄
/courses 🟡 54 🟡 86 🟢 96 🟢 100 📄
/showcase 🟡 51 🟡 87 🟡 75 🟡 86 📄
/community 🟡 54 🟡 86 🟢 96 🟢 100 📄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add estimated reading time to articles and tutorial pages

1 participant